/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bio.jpa.entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "user_previlege", catalog = "biodb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "UserPrevilege.findAll", query = "SELECT u FROM UserPrevilege u"),
    @NamedQuery(name = "UserPrevilege.findByCanRead", query = "SELECT u FROM UserPrevilege u WHERE u.canRead = :canRead"),
    @NamedQuery(name = "UserPrevilege.findByCanWrite", query = "SELECT u FROM UserPrevilege u WHERE u.canWrite = :canWrite"),
    @NamedQuery(name = "UserPrevilege.findByCanDelete", query = "SELECT u FROM UserPrevilege u WHERE u.canDelete = :canDelete"),
    @NamedQuery(name = "UserPrevilege.findByUidFk", query = "SELECT u FROM UserPrevilege u WHERE u.uidFk = :uidFk")})
public class UserPrevilege implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "can_read")
    private Boolean canRead;
    @Column(name = "can_write")
    private Boolean canWrite;
    @Column(name = "can_delete")
    private Boolean canDelete;
    @Id
    @Basic(optional = false)
    @Column(name = "uid_fk")
    private Integer uidFk;
    @JoinColumn(name = "uid_fk", referencedColumnName = "user_id", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private User user;

    public UserPrevilege() {
    }

    public UserPrevilege(Integer uidFk) {
        this.uidFk = uidFk;
    }

    public Boolean getCanRead() {
        return canRead;
    }

    public void setCanRead(Boolean canRead) {
        this.canRead = canRead;
    }

    public Boolean getCanWrite() {
        return canWrite;
    }

    public void setCanWrite(Boolean canWrite) {
        this.canWrite = canWrite;
    }

    public Boolean getCanDelete() {
        return canDelete;
    }

    public void setCanDelete(Boolean canDelete) {
        this.canDelete = canDelete;
    }

    public Integer getUidFk() {
        return uidFk;
    }

    public void setUidFk(Integer uidFk) {
        this.uidFk = uidFk;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (uidFk != null ? uidFk.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserPrevilege)) {
            return false;
        }
        UserPrevilege other = (UserPrevilege) object;
        if ((this.uidFk == null && other.uidFk != null) || (this.uidFk != null && !this.uidFk.equals(other.uidFk))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bio.jpa.entities.UserPrevilege[ uidFk=" + uidFk + " ]";
    }
    
}
